﻿#region Usings

using System.Data.Entity;
using System.Data.Entity.Infrastructure;
using System.Data.Objects;
using xConnected.Core.Interfaces.Data;
using xConnected.Core.Model;

#endregion

namespace xConnected.Data
{
    public class DataContext : DbContext, IDataContext
    {
        //If you do not use the scaffolders, register your domainmodel entities here.
        //public DbSet<T> EntityNames { get; set; }        

        public DataContext()
            : this(false)
        {
        }

        /// <summary>
        ///   Multiple options here... Use connstring or a name for the database.
        ///   Using a name will create a db on .\SqlExpress
        /// </summary>
        public DataContext(bool proxyCreation = true)
            : base("DataContext")
        {
            Configuration.ProxyCreationEnabled = proxyCreation;
            Configuration.ValidateOnSaveEnabled = false;

            //[DropAndReCreate if in debug and model is changed. ONLY FOR DEVELOPMENT!!!]
            //This is handled in App_Start EntityFramework_SqlServerCompact by default...
            //if (System.Diagnostics.Debugger.IsAttached)
            //    Database.SetInitializer(new CustomContextInitializer());
        }


        protected override void OnModelCreating(DbModelBuilder modelBuilder)
        {
            // User
            modelBuilder.Entity<User>().HasKey(u => u.Id);
            modelBuilder.Entity<User>().Property(u => u.Email).IsRequired().HasMaxLength(50);
            modelBuilder.Entity<User>().Property(u => u.Username).IsRequired().HasMaxLength(50);
            modelBuilder.Entity<User>().Property(u => u.Password).IsRequired().HasMaxLength(50);
            modelBuilder.Entity<User>().Property(u => u.ActivationKey).IsRequired();
            modelBuilder.Entity<User>().Property(u => u.IsActivated).IsRequired();
            modelBuilder.Entity<User>().Property(u => u.AccountType).IsRequired();
            modelBuilder.Entity<User>().HasMany(u => u.ExpertProfiles).WithRequired(p => p.User).WillCascadeOnDelete();
            modelBuilder.Entity<User>().HasMany(u => u.CompanyProfiles).WithRequired(p => p.User).WillCascadeOnDelete();
            modelBuilder.Entity<User>().HasMany(u => u.MessageFolders).WithRequired(m => m.Owner).HasForeignKey(m => m.OwnerId).WillCascadeOnDelete();
            modelBuilder.Entity<User>().HasMany(u => u.ExpertLists).WithRequired(m => m.Owner).HasForeignKey(m => m.OwnerId).WillCascadeOnDelete();
            modelBuilder.Entity<User>().HasMany(u => u.CompanyLists).WithRequired(m => m.Owner).HasForeignKey(m => m.OwnerId).WillCascadeOnDelete();
            modelBuilder.Entity<User>().HasMany(u => u.PositionLists).WithRequired(m => m.Owner).HasForeignKey(m => m.OwnerId).WillCascadeOnDelete();

            // Country
            modelBuilder.Entity<Country>().HasKey(c => c.Id);
            modelBuilder.Entity<Country>().Property(c => c.ShortName).IsRequired().HasMaxLength(3);
            modelBuilder.Entity<Country>().Property(c => c.Description).IsRequired().HasMaxLength(100);
            modelBuilder.Entity<Country>().HasMany(c => c.ExpertProfiles).WithRequired(p => p.Country).HasForeignKey(p => p.CountryId).WillCascadeOnDelete();
            modelBuilder.Entity<Country>().HasMany(c => c.CompanyProfiles).WithRequired(p => p.Country).HasForeignKey(p => p.CountryId).WillCascadeOnDelete();
            modelBuilder.Entity<Country>().HasMany(c => c.Positions).WithRequired(p => p.Country).HasForeignKey(p => p.CountryId);
            modelBuilder.Entity<Country>().HasMany(c => c.TitleTranslations).WithOptional(p => p.CountryText).HasForeignKey(p => p.CountryTextId).WillCascadeOnDelete();

            // Industry
            modelBuilder.Entity<Industry>().HasKey(i => i.Id);
            modelBuilder.Entity<Industry>().Property(i => i.Description).IsRequired().HasMaxLength(50);
            modelBuilder.Entity<Industry>().Property(i => i.Key).IsRequired().HasMaxLength(100);
            modelBuilder.Entity<Industry>().HasMany(i => i.Categories).WithRequired(c => c.Industry).HasForeignKey(c => c.IndustryId).WillCascadeOnDelete();
            modelBuilder.Entity<Industry>().HasMany(i => i.Technologies).WithRequired(t => t.Industry).HasForeignKey(t => t.IndustryId).WillCascadeOnDelete();
            modelBuilder.Entity<Industry>().HasMany(i => i.ExpertProfiles).WithRequired(p => p.Industry).HasForeignKey(p => p.IndustryId).WillCascadeOnDelete();
            modelBuilder.Entity<Industry>().HasMany(i => i.CompanyProfiles).WithRequired(c => c.Industry).HasForeignKey(c => c.IndustryId).WillCascadeOnDelete();
            modelBuilder.Entity<Industry>().HasMany(i => i.Positions).WithRequired(c => c.Industry).HasForeignKey(c => c.IndustryId).WillCascadeOnDelete();
            modelBuilder.Entity<Industry>().HasMany(i => i.TitleTranslations).WithOptional(p => p.IndustryText).HasForeignKey(p => p.IndustryTextId).WillCascadeOnDelete();
            modelBuilder.Entity<Industry>().HasMany(i => i.DescriptionTranslations).WithOptional(p => p.IndustryDescription).HasForeignKey(p => p.IndustryDescriptionId).WillCascadeOnDelete();

            // Category
            modelBuilder.Entity<Category>().HasKey(c => c.Id);
            modelBuilder.Entity<Category>().Property(c => c.Description).IsRequired().HasMaxLength(250);
            modelBuilder.Entity<Category>().Property(c => c.Key).IsRequired().HasMaxLength(250);
            modelBuilder.Entity<Category>().HasOptional(c => c.ParentCategory).WithMany(c => c.ChildCategories).HasForeignKey(c => c.ParentCategoryId).WillCascadeOnDelete(false);
            modelBuilder.Entity<Category>().HasMany(c => c.TitleTranslations).WithOptional(p => p.CategoryText).HasForeignKey(p => p.CategoryTextId).WillCascadeOnDelete();
            modelBuilder.Entity<Category>().HasMany(c => c.DescriptionTranslations).WithOptional(p => p.CategoryDescription).HasForeignKey(p => p.CategoryDescriptionId).WillCascadeOnDelete();

            // Technology
            modelBuilder.Entity<Technology>().HasKey(t => t.Id);
            modelBuilder.Entity<Technology>().Property(t => t.Name).IsRequired().HasMaxLength(50);
            modelBuilder.Entity<Technology>().HasMany(t => t.TechnologySkills).WithRequired(t => t.Technology).HasForeignKey(t => t.TechnologyId).WillCascadeOnDelete(false);

            // ExpertProfile
            modelBuilder.Entity<ExpertProfile>().HasKey(p => p.Id);
            modelBuilder.Entity<ExpertProfile>().Property(u => u.Title).IsRequired().HasMaxLength(30);
            modelBuilder.Entity<ExpertProfile>().Property(u => u.Description).IsRequired().HasMaxLength(100);
            modelBuilder.Entity<ExpertProfile>().Property(u => u.Email).HasMaxLength(50);
            modelBuilder.Entity<ExpertProfile>().Property(u => u.PhoneNumber).HasMaxLength(50);
            modelBuilder.Entity<ExpertProfile>().Property(u => u.Website).HasMaxLength(50);
            modelBuilder.Entity<ExpertProfile>().Property(u => u.Skype).HasMaxLength(50);
            modelBuilder.Entity<ExpertProfile>().Property(u => u.Facebook).HasMaxLength(50);
            modelBuilder.Entity<ExpertProfile>().Property(u => u.Twitter).HasMaxLength(50);
            modelBuilder.Entity<ExpertProfile>().Property(u => u.Linkedin).HasMaxLength(50);
            modelBuilder.Entity<ExpertProfile>().Property(u => u.HourRate);
            modelBuilder.Entity<ExpertProfile>().Property(u => u.DailyRate);
            modelBuilder.Entity<ExpertProfile>().Property(u => u.MonthlyRate);
            modelBuilder.Entity<ExpertProfile>().Property(u => u.AnnualRate);
            modelBuilder.Entity<ExpertProfile>().Property(u => u.CommentRate).HasMaxLength(100);
            modelBuilder.Entity<ExpertProfile>().Property(u => u.JobType);
            modelBuilder.Entity<ExpertProfile>().Property(u => u.Experience).HasMaxLength(4096);
            modelBuilder.Entity<ExpertProfile>().Property(u => u.References).HasMaxLength(4096);
            modelBuilder.Entity<ExpertProfile>().Property(u => u.Other).HasMaxLength(1024);
            modelBuilder.Entity<ExpertProfile>().Property(u => u.Photo).HasMaxLength(250);
            modelBuilder.Entity<ExpertProfile>().Property(u => u.Cv).HasMaxLength(250);
            modelBuilder.Entity<ExpertProfile>().Property(u => u.Location).HasMaxLength(100);
            modelBuilder.Entity<ExpertProfile>().Property(u => u.XLocation);
            modelBuilder.Entity<ExpertProfile>().Property(u => u.YLocation);
            modelBuilder.Entity<ExpertProfile>().Property(u => u.AvailabilityStatus);
            modelBuilder.Entity<ExpertProfile>().Property(u => u.Availability).HasMaxLength(100);
            modelBuilder.Entity<ExpertProfile>().Property(u => u.IsDefault).IsRequired();
            modelBuilder.Entity<ExpertProfile>().Ignore(p => p.AvailabilityStatusText);
            modelBuilder.Entity<ExpertProfile>().Ignore(p => p.EmploymentTypeText);
            modelBuilder.Entity<ExpertProfile>().Ignore(p => p.IsAuthenticated);
            modelBuilder.Entity<ExpertProfile>().HasMany(p => p.CategorySkills).WithRequired(c => c.ExpertProfile).HasForeignKey(c => c.ExpertProfileId).WillCascadeOnDelete();
            modelBuilder.Entity<ExpertProfile>().HasMany(p => p.TechnologySkills).WithRequired(c => c.ExpertProfile).HasForeignKey(p => p.ExpertProfileId).WillCascadeOnDelete();
            modelBuilder.Entity<ExpertProfile>().HasMany(p => p.EducationSkills).WithRequired(e => e.ExpertProfile).HasForeignKey(e => e.ExpertProfileId).WillCascadeOnDelete();
            modelBuilder.Entity<ExpertProfile>().HasMany(p => p.LanguageSkills).WithRequired(c => c.ExpertProfile).HasForeignKey(p => p.ExpertProfileId).WillCascadeOnDelete();
            modelBuilder.Entity<ExpertProfile>().HasMany(u => u.MessageUsers).WithRequired(m => m.ExpertProfile).HasForeignKey(m => m.ExpertProfileId).WillCascadeOnDelete();

            // Company Profile
            modelBuilder.Entity<CompanyProfile>().HasKey(c => c.Id);
            modelBuilder.Entity<CompanyProfile>().Property(c => c.Title).IsRequired().HasMaxLength(30);
            modelBuilder.Entity<CompanyProfile>().Property(c => c.TagLine).IsRequired().HasMaxLength(100);
            modelBuilder.Entity<CompanyProfile>().Property(c => c.Description).IsRequired().HasMaxLength(4096);
            modelBuilder.Entity<CompanyProfile>().Property(c => c.Website).IsRequired().HasMaxLength(50);
            modelBuilder.Entity<CompanyProfile>().Property(c => c.Location).IsRequired().HasMaxLength(50);
            modelBuilder.Entity<CompanyProfile>().Property(u => u.XLocation);
            modelBuilder.Entity<CompanyProfile>().Property(u => u.YLocation);
            modelBuilder.Entity<CompanyProfile>().Property(c => c.Photo).HasMaxLength(250);
            modelBuilder.Entity<CompanyProfile>().Property(c => c.Email).IsRequired().HasMaxLength(50);
            modelBuilder.Entity<CompanyProfile>().Property(c => c.PhoneNumber).IsRequired().HasMaxLength(50);
            modelBuilder.Entity<CompanyProfile>().Property(u => u.IsDefault).IsRequired();
            modelBuilder.Entity<CompanyProfile>().Ignore(p => p.IsAuthenticated);
            modelBuilder.Entity<CompanyProfile>().HasMany(c => c.Positions).WithRequired(p => p.CompanyProfile).HasForeignKey(p => p.CompanyProfileId).WillCascadeOnDelete();
            modelBuilder.Entity<CompanyProfile>().HasMany(p => p.Categories).WithMany(p => p.CompanyProfiles).Map(m =>
                                                                                                                      {
                                                                                                                          m.ToTable("CompanyProfileCategories");
                                                                                                                          m.MapLeftKey("CompanyProfileId");
                                                                                                                          m.MapRightKey("CategoryId");
                                                                                                                      });
            modelBuilder.Entity<CompanyProfile>().HasMany(p => p.Technologies).WithMany(p => p.CompanyProfiles).Map(m =>
                                                                                                                        {
                                                                                                                            m.ToTable("CompanyProfileTechnologies");
                                                                                                                            m.MapLeftKey("CompanyProfileId");
                                                                                                                            m.MapRightKey("TechnologyId");
                                                                                                                        });
            modelBuilder.Entity<CompanyProfile>().HasMany(u => u.MessageUsers).WithRequired(m => m.CompanyProfile).HasForeignKey(m => m.CompanyProfileId).WillCascadeOnDelete();


            // Position
            modelBuilder.Entity<Position>().HasKey(p => p.Id);
            modelBuilder.Entity<Position>().Property(p => p.Title).IsRequired().HasMaxLength(50);
            modelBuilder.Entity<Position>().Property(p => p.Description).IsRequired().HasMaxLength(4096);
            modelBuilder.Entity<Position>().Property(p => p.StartDate).IsRequired();
            modelBuilder.Entity<Position>().Property(p => p.Duration).IsRequired();
            modelBuilder.Entity<Position>().Property(p => p.Location).IsRequired();
            modelBuilder.Entity<Position>().Property(u => u.XLocation);
            modelBuilder.Entity<Position>().Property(u => u.YLocation);
            modelBuilder.Entity<Position>().Property(c => c.Photo).HasMaxLength(250);
            modelBuilder.Entity<Position>().Property(p => p.JobType).IsRequired();
            modelBuilder.Entity<Position>().Property(u => u.IsDefault).IsRequired();
            modelBuilder.Entity<Position>().Ignore(p => p.ContractTypeText);
            modelBuilder.Entity<Position>().Ignore(p => p.IsAuthenticated);
            modelBuilder.Entity<Position>().HasMany(p => p.Categories).WithMany(p => p.Positions).Map(m =>
                                                                                                        {
                                                                                                            m.ToTable("PositionCategories");
                                                                                                            m.MapLeftKey("PositionId");
                                                                                                            m.MapRightKey("CategoryId");
                                                                                                        });
            modelBuilder.Entity<Position>().HasMany(p => p.Technologies).WithMany(p => p.Positions).Map(m =>
                                                                                                          {
                                                                                                              m.ToTable("PositionTechnologies");
                                                                                                              m.MapLeftKey("PositionId");
                                                                                                              m.MapRightKey("TechnologyId");
                                                                                                          });
            modelBuilder.Entity<Position>().HasMany(u => u.MessageUsers).WithRequired(m => m.Position).HasForeignKey(m => m.PositionId).WillCascadeOnDelete();

            // Category skill
            modelBuilder.Entity<CategorySkill>().HasKey(t => t.Id);
            modelBuilder.Entity<CategorySkill>().Property(t => t.Level).IsRequired();
            modelBuilder.Entity<CategorySkill>().Property(t => t.Experience).IsRequired();

            // Technology skill
            modelBuilder.Entity<TechnologySkill>().HasKey(t => t.Id);
            modelBuilder.Entity<TechnologySkill>().Property(t => t.Level).IsRequired();
            modelBuilder.Entity<TechnologySkill>().Property(t => t.Experience).IsRequired();

            // Education
            modelBuilder.Entity<Education>().HasKey(e => e.Id);
            modelBuilder.Entity<Education>().Property(e => e.Title).IsRequired().HasMaxLength(15);
            modelBuilder.Entity<Education>().Property(e => e.Description).IsRequired().HasMaxLength(100);
            modelBuilder.Entity<Education>().HasMany(e => e.EducationSkills).WithRequired(e => e.Education).HasForeignKey(e => e.EducationId).WillCascadeOnDelete();
            modelBuilder.Entity<Education>().HasMany(e => e.TitleTranslations).WithOptional(p => p.EducationText).HasForeignKey(p => p.EducationTextId).WillCascadeOnDelete();

            // Education skill
            modelBuilder.Entity<EducationSkill>().HasKey(l => l.Id);
            modelBuilder.Entity<EducationSkill>().Property(l => l.Program).HasMaxLength(100).IsRequired();
            modelBuilder.Entity<EducationSkill>().Property(l => l.University).HasMaxLength(300).IsRequired();
            modelBuilder.Entity<EducationSkill>().Property(l => l.BeginYear).IsRequired();
            modelBuilder.Entity<EducationSkill>().Property(l => l.EndYear);

            // Language
            modelBuilder.Entity<Language>().HasKey(l => l.Id);
            modelBuilder.Entity<Language>().Property(l => l.ShortName).IsRequired().HasMaxLength(3);
            modelBuilder.Entity<Language>().Property(l => l.Description).IsRequired().HasMaxLength(100);
            modelBuilder.Entity<Language>().HasMany(l => l.LanguageSkills).WithRequired(l => l.Language).HasForeignKey(l => l.LanguageId).WillCascadeOnDelete();
            modelBuilder.Entity<Language>().HasMany(l => l.Translations).WithRequired(p => p.Language).HasForeignKey(p => p.LanguageId).WillCascadeOnDelete();
            modelBuilder.Entity<Language>().HasMany(l => l.TitleTranslations).WithOptional(p => p.LanguageText).HasForeignKey(p => p.LanguageTextId).WillCascadeOnDelete();

            // Language skill
            modelBuilder.Entity<LanguageSkill>().HasKey(l => l.Id);
            modelBuilder.Entity<LanguageSkill>().Property(l => l.Level).IsRequired();

            // Message
            modelBuilder.Entity<Message>().HasKey(m => m.Id);
            modelBuilder.Entity<Message>().Property(m => m.Subject).HasMaxLength(255).IsRequired();
            modelBuilder.Entity<Message>().Property(m => m.Body).IsRequired();
            modelBuilder.Entity<Message>().Property(m => m.AllRecipientsVisible);
            modelBuilder.Entity<Message>().Ignore(m => m.IsChecked);
            modelBuilder.Entity<Message>().HasOptional(m => m.Parent).WithMany(m => m.Children).HasForeignKey(m => m.ParentId).WillCascadeOnDelete(false);
            modelBuilder.Entity<Message>().HasMany(m => m.MessageExpertUsers).WithRequired(m => m.Message).HasForeignKey(m => m.MessageId);
            modelBuilder.Entity<Message>().HasMany(m => m.MessageCompanyUsers).WithRequired(m => m.Message).HasForeignKey(m => m.MessageId);
            modelBuilder.Entity<Message>().HasMany(m => m.MessagePositionUsers).WithRequired(m => m.Message).HasForeignKey(m => m.MessageId);

            // Message folder
            modelBuilder.Entity<MessageFolder>().HasKey(u => u.Id);
            modelBuilder.Entity<MessageFolder>().Property(m => m.Name).HasMaxLength(20).IsRequired();
            modelBuilder.Entity<MessageFolder>().Property(m => m.FolderType).IsRequired();
            modelBuilder.Entity<MessageFolder>().HasMany(m => m.MessageExpertUsers).WithRequired(m => m.MessageFolder).HasForeignKey(m => m.MessageFolderId).WillCascadeOnDelete();
            modelBuilder.Entity<MessageFolder>().HasMany(m => m.MessageCompanyUsers).WithRequired(m => m.MessageFolder).HasForeignKey(m => m.MessageFolderId).WillCascadeOnDelete();
            modelBuilder.Entity<MessageFolder>().HasMany(m => m.MessagePositionUsers).WithRequired(m => m.MessageFolder).HasForeignKey(m => m.MessageFolderId).WillCascadeOnDelete();

            // Message Expert user
            modelBuilder.Entity<MessageExpertUser>().HasKey(m => m.Id);
            modelBuilder.Entity<MessageExpertUser>().Property(m => m.IsRead).IsRequired();
            modelBuilder.Entity<MessageExpertUser>().Property(m => m.IsStarred).IsRequired();
            modelBuilder.Entity<MessageExpertUser>().Property(m => m.IsSender).IsRequired();
            modelBuilder.Entity<MessageExpertUser>().Property(m => m.IsDeleted).IsRequired();
            modelBuilder.Entity<MessageExpertUser>().Ignore(m => m.Sender);
            modelBuilder.Entity<MessageExpertUser>().Ignore(m => m.Receivers);

            // Message company user
            modelBuilder.Entity<MessageCompanyUser>().HasKey(m => m.Id);
            modelBuilder.Entity<MessageCompanyUser>().Property(m => m.IsRead).IsRequired();
            modelBuilder.Entity<MessageCompanyUser>().Property(m => m.IsStarred).IsRequired();
            modelBuilder.Entity<MessageCompanyUser>().Property(m => m.IsSender).IsRequired();
            modelBuilder.Entity<MessageCompanyUser>().Property(m => m.IsDeleted).IsRequired();
            modelBuilder.Entity<MessageCompanyUser>().Ignore(m => m.Sender);
            modelBuilder.Entity<MessageCompanyUser>().Ignore(m => m.Receivers);


            // Message Position user
            modelBuilder.Entity<MessagePositionUser>().HasKey(m => m.Id);
            modelBuilder.Entity<MessagePositionUser>().Property(m => m.IsRead).IsRequired();
            modelBuilder.Entity<MessagePositionUser>().Property(m => m.IsStarred).IsRequired();
            modelBuilder.Entity<MessagePositionUser>().Property(m => m.IsSender).IsRequired();
            modelBuilder.Entity<MessagePositionUser>().Property(m => m.IsDeleted).IsRequired();
            modelBuilder.Entity<MessagePositionUser>().Ignore(m => m.Sender);
            modelBuilder.Entity<MessagePositionUser>().Ignore(m => m.Receivers);

            // Expert List
            modelBuilder.Entity<ExpertList>().HasKey(m => m.Id);
            modelBuilder.Entity<ExpertList>().Property(m => m.Name).IsRequired();
            modelBuilder.Entity<ExpertList>().Property(m => m.IsBlackList).IsRequired();
            modelBuilder.Entity<ExpertList>().HasMany(p => p.ExpertProfiles).WithMany(p => p.ExpertLists).Map(m =>
            {
                m.ToTable("ExpertListExpertProfiles");
                m.MapLeftKey("ExpertListId");
                m.MapRightKey("ExpertProfileId");
            });

            // Company List
            modelBuilder.Entity<CompanyList>().HasKey(m => m.Id);
            modelBuilder.Entity<CompanyList>().Property(m => m.Name).IsRequired();
            modelBuilder.Entity<CompanyList>().Property(m => m.IsBlackList).IsRequired();
            modelBuilder.Entity<CompanyList>().HasMany(p => p.CompanyProfiles).WithMany(p => p.CompanyLists).Map(m =>
            {
                m.ToTable("CompanyListCompanyProfiles");
                m.MapLeftKey("CompanyListId");
                m.MapRightKey("CompanyProfileId");
            });

            // Position List
            modelBuilder.Entity<PositionList>().HasKey(m => m.Id);
            modelBuilder.Entity<PositionList>().Property(m => m.Name).IsRequired();
            modelBuilder.Entity<PositionList>().Property(m => m.IsBlackList).IsRequired();
            modelBuilder.Entity<PositionList>().HasMany(p => p.Positions).WithMany(p => p.PositionLists).Map(m =>
            {
                m.ToTable("PositionListPositions");
                m.MapLeftKey("PositionListId");
                m.MapRightKey("PositionId");
            });

            // Translation
            modelBuilder.Entity<Translation>().HasKey(t => t.Id);
            modelBuilder.Entity<Translation>().Property(t => t.Text).IsRequired().HasMaxLength(500);
           



            //Implement custom setup here... ColumnNames, Validation, Relations etc.
            base.OnModelCreating(modelBuilder);
        }

        public ObjectContext ObjectContext()
        {
            return ((IObjectContextAdapter) this).ObjectContext;
        }

        public virtual IDbSet<T> DbSet<T>() where T : PersistentEntity
        {
            return Set<T>();
        }

        public new DbEntityEntry Entry<T>(T entity) where T : PersistentEntity
        {
            return base.Entry(entity);
        }

        public DbSet<User> Users { get; set; }

        public DbSet<Industry> Industries { get; set; }

        public DbSet<ExpertProfile> ExpertProfiles { get; set; }

        public DbSet<CompanyProfile> CompanyProfiles { get; set; }

        public DbSet<Position> Positions { get; set; }

        public DbSet<Education> Educations { get; set; }

        public DbSet<Category> Categories { get; set; }

        public DbSet<Language> Languages { get; set; }

        public DbSet<LanguageSkill> LanguageSkills { get; set; }

        public DbSet<Country> Countries { get; set; }

        public DbSet<Technology> Technologies { get; set; }

        public DbSet<TechnologySkill> TechnologySkills { get; set; }

        public DbSet<EducationSkill> EducationSkills { get; set; }

        public DbSet<CategorySkill> CategorySkills { get; set; }

        public DbSet<MessageExpertUser> MessageExpertUsers { get; set; }

        public DbSet<MessageFolder> MessageFolders { get; set; }

        public DbSet<Message> Messages { get; set; }

        public DbSet<MessageCompanyUser> MessageCompanyUsers { get; set; }

        public DbSet<MessagePositionUser> MessagePositionUsers { get; set; }

        public DbSet<ExpertList> ExpertLists { get; set; }

        public DbSet<CompanyList> CompanyLists { get; set; }

        public DbSet<PositionList> PositionLists { get; set; }

        public DbSet<Translation> Translations { get; set; }
    }
}